//
//  EditViewController.m
//  collageForZhang
//
//  Created by lht on 16-5-31.
//  Copyright (c) 2016年 zhshy. All rights reserved.
//

#import "EditViewController.h"
#import "EditTableViewCell.h"
#import "InfoListViewController.h"
@interface EditViewController ()

@end

@implementation EditViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.tableView.scrollEnabled = NO;
//    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.tableFooterView = [[UIView alloc] init];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
#pragma mark - table view delegate & data source
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    NSUInteger row = [indexPath row];
    
    NSString *CellIdentifier = [NSString stringWithFormat:@"EditTableViewCell"];
    EditTableViewCell *cell = [_tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [EditTableViewCell cell];
        cell.backgroundColor = [UIColor whiteColor];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    
    switch (row) {
        case 0:
            cell.imgView.image = [UIImage imageNamed:@"teacher@2x"];
            cell.titleLbl.text = @"教师列表";
            break;
        case 1:
            cell.imgView.image = [UIImage imageNamed:@"classes@2x"];
            cell.titleLbl.text = @"班级列表";
            break;
        case 2:
            cell.imgView.image = [UIImage imageNamed:@"curriculum@2x"];
            cell.titleLbl.text = @"课程列表";
            break;
        case 3:
            cell.imgView.image = [UIImage imageNamed:@"semester@2x"];
            cell.titleLbl.text = @"学期安排";
            break;
        default:
            break;
    }
    
    return cell;

}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 4;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return [EditTableViewCell height];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    NSUInteger row = [indexPath row];
    InfoListViewController *infoVC = [[InfoListViewController alloc] initWithNibName:@"InfoListViewController" bundle:nil];
    
    switch (row) {
        case 0:
            infoVC.titleStr = @"教师列表";
            break;
        case 1:
            infoVC.titleStr = @"班级列表";
            break;
        case 2:
            infoVC.titleStr = @"课程列表";
            break;
        case 3:
            infoVC.titleStr = @"学期安排";
            break;
        default:
            break;
    }
    [self.navigationController pushViewController:infoVC animated:YES];
}
@end
